Most general purpose computer systems (computers) are able to display text, comprised of characters (letters, numerals, and other symbols), on attached display devices, such as monitors and printers. A monitor consists of a grid of points, or pixels, each of which can be individually illuminated. Computer printers and other computer display devices also use pixels to display images.
In order to display text on a display device, computers use one or more raster fonts. A raster font is comprised of character bitmaps. Each character bitmap contains data reflecting which pixels in a subset of the display grid must be illuminated in order to form a particular character. When a computer needs to display a particular character at a display location, it accesses the bitmap for that character. The computer then turns the illumination of pixels near the display position on or off in accordance with the data stored in the character bitmap. FIG. 1A is a diagram showing how one possible bitmap of the letter A could be displayed on a display device.
At one point, computers each used only a single raster font, permanently stored in read only memory. Since then, computers have been adapted to use several different raster fonts simultaneously. This permits a user to display text in more than one typeface and point size. (A typeface is a specific design for a set of characters. Point size is a measurement of the height of a font's characters.) These raster fonts are now stored in writeable random access memory, which allows existing raster fonts to be altered and new raster fonts added.
Computers now also use another, more robust type of font, called outline fonts. Outline fonts contain an outline for each character, comprised of straight lines and curves that form the shape of the character's outline. FIG. 1B is a diagram showing one possible outline of the letter A. The outline font describes these straight lines and curves in terms of an arbitrary system of coordinates. The computer can resize these character outlines to any point size, then convert them to a raster font. Outline fonts also contain hints, which are routines that, when executed, adjust the shapes of the outlines for various point sizes to improve their appearance.
Computers use outline fonts to create raster fonts in various sizes. Computers also transmit outline fonts to smart display devices that are themselves able to create raster fonts from the outline fonts. Many computers now store several outline fonts, each corresponding to a different typeface.
Using outline fonts, computers can now create raster fonts dynamically in different typefaces in response to the needs of users. Computer programs like ProvideRaster provide this service. FIG. 2 is a flow diagram of the ProvideRaster program. This program is an example of a font manager program that is called by application programs (applications), such as a word processor or a spreadsheet, when they require a raster font. The program is passed a requested typeface name, point size, and horizontal and vertical densities of the intended display device. The program returns a raster font of the requested typeface and point size for the intended display device.
In step 201, if a raster font of the correct point size and horizontal and vertical pixel density is available within the computer, then the program continues at step 202, else the program continues at step 203. In step 202, the program retrieves the appropriate raster font. The program then returns the retrieved raster font to the application program.
In step 203, if an outline font for the requested typeface is available within the computer, then the program continues in step 204, else the program continues in step 205 to create a substitute font for the unavailable outline font. In step 204, the program retrieves the outline font for the requested typeface, which contains both character outlines and hints. The program then continues at step 206.
In step 205, the program calls CreateSubstituteFont to produce a substitute outline font that visually approximates the unavailable outline font. The program passes CreateSubstituteFont the unavailable outline font name. The CreateSubstituteFont program returns a substitute outline font for the unavailable font, which contains both character outlines and hints. The details of CreateSubstituteFont are discussed further below. When CreateSubstituteFont returns, the program continues at step 206.
In step 206, the program calls a ConvertToRaster program, passing it the outline font retrieved or created, the requested point size, and the requested horizontal and vertical densities. The program then returns the raster font created by ConvertToRaster to the application program.
FIG. 3 is a flow diagram of ConvertToRaster. The program receives as parameters an outline font, a requested point size, and a requested horizontal and vertical density. The outline font contains character outlines and hints.
In step 301, the program resizes the character outlines of the outline font to the requested point size by multiplying the coordinates that define the outlines' lines and curves by the requested point size. This alters the height and width of each character. In step 302, the program applies the hints of the outline font to the magnified outlines.
FIGS. 4A-B are screen images demonstrating the need to use hints to improve the appearance of rasterized outlines. FIG. 4A is a screen image showing a letter "n" that has been rasterized without first being hinted. The unhinted letter's left base serif 401 does not match its right base serif 402. Further, its left vertical stem 403 is wider than its right vertical stem 404. Finally, its crown 405 is skewed toward the top row of pixels. FIG. 4B is a screen image showing a letter "n" that was rasterized after being hinted. The hinted letter's base serifs 411 and 412 are of the same width relative to their respective vertical stems 413 and 414. Those vertical stems are both now two pixels wide. The height of its crown 415 has been balanced by moving the vertical stems apart slightly. The hints demonstrated by FIG. 4B ensure the symmetry and regularity of the characters of a font. Other traditional hints ensure the vertical alignment of corresponding features of characters. Further traditional hints ensure good color--that is, consistent weighting among characters of a font. Applying hints to a character is said to regularize the character.
In step 303, the program rasterizes the hinted outlines of the outline font by superimposing a grid corresponding to the horizontal and vertical density of the intended display device over the hinted outlines, then turning on any pixels of the grid whose centers fall within the hinted outlines. This technique is well known in the art of digital typography. The program returns the resulting raster font to the application program, which may use it to display text. The raster font may also be stored in a buffer to be used to satisfy any identical requests received in the future.
The function served by CreateSubstituteFont is quite important. It is difficult for a computer user to anticipate which outline fonts he or she will need. Outline fonts will hereafter be referred to simply as fonts. Since individual fonts can be expensive to license, and even more expensive to independently develop, it has become quite useful for a computer to be able to construct a substitute font for an unavailable font.
The substitute fonts created by CreateSubstituteFont should: (1) be similar in appearance to the unavailable font, if possible; and (2) have exactly the same overall character widths as the unavailable font. These requirements are dictated by the paradigm of using the substitute font in place of the unavailable font to display a particular section of text in a document. The first requirement ensures that a sense of any aesthetics intended for the section will be conveyed. The second requirement ensures that lines and pages will break at the correct points.
Existing implementations of CreateSubstituteFont work by selecting an available font (the basis font) on which to base the substitute font, then modifying the basis font to create the substitute font. Basis font selection processes vary, as do their effectiveness at selecting a basis font with an appearance similar to the unavailable font.
Modification processes typically consist only of adding space before or after each character of the basis font whose overall width is smaller than the corresponding character of the unavailable font. Such implementations produce fonts with the same overall character widths in the case of characters of the basis font whose overall widths are smaller than or equal to those of the corresponding characters of the unavailable font. Such implementations cannot, however, produce fonts with the same overall character widths in the case of characters of the basis font whose overall widths are larger than those of the corresponding character of the unavailable font. It can be seen that these implementations of CreateSubstituteFont satisfy the first requirement for substitute fonts to varying degrees, and the second, more important requirement only sporadically.